{include file=member.header.html}
<script type="text/javascript">
$(function(){
    var t = new EditableTable($('#my_goods'));
    $('#truncate').click(function(){
        var goods_ids = '{$goods_ids}';
        if(goods_ids && confirm('{sprintf lang=truncate_confirm var1=page_info.item_count}')){
            $('#truncate_form').append('<input type="hidden" name="act" value="truncate" />');
            $('#truncate_form').append('<input type="hidden" name="goods_ids" value="' + goods_ids + '" />');
            $('#truncate_form').submit();
            return false;
        }
    });
});
</script>
<style>
.member_no_records {border-top: 0px !important;}
.table td{ padding-left: 5px; }
.table .ware_text { width: 155px; }
.linkbtn{cursor: pointer;}
#goods_edit_stock{padding: 0;}
#goods_edit_stock .title{padding: 10px 25px 15px;}
#goods_edit_stock .title h3{padding-left: 5px;border-left: 5px solid #e6445b;}
#goods-format{padding: 10px 0px 13px 20px;}
#goods_edit_stock #goods-format .goods-f-d{padding: 10px;width: 450px;}
#goods_edit_stock #goods-format dd{width: 350px;}
#goods_edit_stock .goods-sub{padding: 20px 35px 30px;border-top:1px dashed #ccc;}
</style>
<div class="content">
	{include file=path.html}
      {include file=member.menu.html}
	<!------content start------>
	<div class="con-r-global">
		<div class="goods-show-t">
			<form id="truncate_form" method="post"></form>
			<form name="goods-select-frm" method="get" id="my_goods_form">
				<input type="hidden" name="app" value="my_goods">
				<table width="100%">
					<tbody>
						<tr>
							<td width="120" align="right">商品货号：</td>
							<td width="180">
								<input type="text" name="goodsNum" value="{$gets[goodsNum]}"></td>
							<td width="100" align="right">商品名称：</td>
							<td width="200">
								<input type="text" name="goodsName" value="{$gets[goodsName]}"></td>
							<td>商品ID： <input type="text" name="goodsId" value="{$gets[goodsId]}"></td>
						</tr>
						<tr>
							<td align="right">价格：</td>
							<td>
								<input type="text" class="goods-sinput" onblur="wl.zInt(this)" name="priceFrom" value="{$gets[priceFrom]}">
								到
								<input type="text" class="goods-sinput" onblur="wl.zInt(this)" name="priceTo" value="{$gets[priceTo]}"></td>
							<td align="right">销量：</td>
							<td>
								<input type="text" class="goods-sinput" onblur="wl.zInt(this)" name="saleFrom" value="{$gets[saleFrom]}">
								到
								<input type="text" class="goods-sinput" onblur="wl.zInt(this)" name="saleTo" value="{$gets[saleTo]}"></td>
							<td>&nbsp;</td>
						</tr>
						<tr>
							<td align="right">店铺商品分类：</td>
							<td>
								<select id="goodsCategory" name="goodsCategory">
									<option value="0">全部</option>
									{html_options options=$sgcategories selected=$gets[goodsCategory]}
								</select>
							</td>
							<td align="right">商品类目：</td>
							<td>
								<select id="goodsmenu" name="goodsmenu">
									<option value="0">全部</option>
									{html_options options=$parents selected=$gets[goodsmenu]}
								</select>
							</td>
							<td>
								<input type="submit" class="subbtnhs" value="搜 索">
								<input type="button" onclick="location.href='{url app=my_goods}'" name="button" class="subbtnhs" value="重 置" />
							</td>
						</tr>
					</tbody>
				</table>
			</form>
		</div>
		<!--{if $goods_list}-->
		<table width="100%" class="goods-show-th">
			<tbody>
				<tr>
					<th class="width1">
						<input type="checkbox" id="all" class="checkall"/>
					</th>
					<th class="align1" colspan="3">
						<span class="all">
							<label for="all">{$lang.checkall}</label>
						</span>
						|
						<a href="javascript:void(0);" class="edit" ectype="batchbutton" uri="index.php?app=my_goods&act=batch_edit" name="id">{$lang.edit}</a>
						<!--|
						<a href="javascript:void(0);" class="delete" ectype="batchbutton" uri="index.php?app=my_goods&act=drop" name="id" presubmit="confirm('{$lang.drop_confirm}')">{$lang.drop}</a>-->
					</th>
				</tr>
			</tbody>
		</table>
		<table width="100%" class="goods-show-th">
			<tbody>
				<tr>
					<th width="2%"></th>
					<th width="30%">商品信息</th>
					<th width="13%">商品分类</th>
					<th width="11%">价格</th>
					<th width="9%">库存</th>
					<th width="8%">总销量</th>
					<th width="12%">状态</th>
					<th width="12%">操作</th>
				</tr>
			</tbody>
		</table>
		<!-- {foreach from=$goods_list item=item} -->
		<table width="100%" class="goods-show-each">
			<tr>
				<td width="1%" class="align2">
					<input type="checkbox" class="checkitem" value="{$item.goods_id}"/>
				</td>
				<td width="8%">
					<div class="goods-show-img">
						<a href="{jsurl index.php?app=goods&id=$item.goods_id}" target="_blank">
							<img height="100" alt="" src="{$item[default_image]}"></a>
					</div>
				</td>
				<td width="19%">
					<p>
						<a href="{jsurl index.php?app=goods&id=$item.goods_id}" target="_blank" class="linkbtn">{$item.goods_name|escape}</a>
					</p>
					<p>商品货号：{$item.sku|escape}</p>
				</td>
				<td width="18%">
					<p>{$item.cate_name}</p>
				</td>
				<td width="10%" align="center">
					<p>
						{if $item.price.price}{$item.price.price|price}{elseif $item.price.min_price}{$item.price.min_price|price}-{$item.price.max_price|price}{else}0{/if}
					</p>
				</td>
				<td width="8%" align="center">
					<p>{$item[stock]}</p>
				</td>
				<td width="8%" align="center">
					<p>{$item[sales]}</p>
				</td>
				<td width="10%">
					<!--{if $item[closed] eq 1}-->禁售<!--{else}--><span id="hhh{$item[goods_id]}">{$item[good_status]}</span><!--{/if}-->
				</td>
				<td width="15%">
					<ul>
						{if $item[if_show] eq 0 || $item[if_show] eq 2}
						<li id="sss{$item[goods_id]}">
							<a class="linkbtn edit" href="{jsurl app=check_goods&id=$item.goods_id}"  target="_blank">预览</a>
						</li>
						{else}
						<li id="sss{$item[goods_id]}">
							{if $item[recommended] eq 1}
							<span class="linkbtn" onclick="recom(this)" val="0" gid="{$item[goods_id]}">取消店铺推荐</span>
							{elseif $item[recommended] eq 0}
							<span class="linkbtn" val="1"  onclick="recom(this)" gid="{$item[goods_id]}">设为店铺推荐</span>
							{/if}
						</li>
						{/if}
						<li id="xxx{$item[goods_id]}">
							{if $item[if_show] eq 1}
							<span class="linkbtn"  onclick="show(this)" val="2" gid="{$item[goods_id]}">下架</span>
							{elseif $item[if_show] eq 2}
							<span class="linkbtn"  onclick="show(this)" val="1" gid="{$item[goods_id]}">上架</span>
							{/if}
						</li>
						<li id="cz">
							<a class="linkbtn edit" href="{url app=my_goods&act=edit&id=$item.goods_id}" >{$lang.edit}</a>
							<br/>
							<!-- <a class="linkbtn edit" href="{url app=my_goods&act=edit_stock&id=$item.goods_id&page=$page_info.curr_page}" >修改库存</a> -->
                                                        <!--{if $show_edit_stock}-->
							<a href="javascript:;" class="linkbtn edit" uri="{url app=my_goods&act=edit_stock&id=$item.goods_id&page=$page_info.curr_page}&ajax" dialog_width="550" dialog_title="" ectype="dialog"  dialog_id="update_goods_stock" id="update_goods_stock">修改库存</a>
                                                        <br/>
                                                        <!--{/if}-->
							<!--<a class="linkbtn delete" href="javascript:drop_confirm('{$lang.drop_confirm}', 'index.php?app=my_goods&amp;act=drop&id={$item.goods_id}');" >{$lang.drop}</a>-->
						</li>
					</ul>
				</td>
			</tr>
		</table>
		<!---{/foreach}-->
		<div class="goods-page">{include file=goods.page.bottom.html}</div>
		<!--{else}-->
		<table width="100%" class="goods-show-each">
			<tbody>
				<tr>
					<td>没有相关的商品信息！</td>
				</tr>
			</tbody>
		</table>
		<!--{/if}-->
		<!--<div class="f-cb">
			<dl class="goods-show-info f-cb">
				<dt></dt>
				<dd>
					<ul>
						<li>
							<h6>商品管理贴士</h6>
						</li>
						<li>
							<a href="">如何让你的产品信息排序靠前？</a>
						</li>
						<li>
							<a href="">如何删除出售中的产品？</a>
						</li>
					</ul>
				</dd>
			</dl>
		</div>-->
	</div>
	<!---content end---->
	<div class="clear"></div>
</div>
<iframe name="iframe_post" id="iframe_post" width="0" height="0"></iframe>
<script type="text/javascript">
	function recom(obj){
		var val = $(obj).attr('val');
		var gid = $(obj).attr('gid');
		var html = '';
		$.get('index.php?app=my_goods&act=ajax_col&column=recommended&value='+val+'&id='+gid,function(data){
			var data = eval('('+data+')');
			if(data.done){
				if(data.retval==1){
					html += '<span class="linkbtn" onclick="recom(this)" val="0"  gid="'+gid+'">取消店铺推荐</span>';
				}else{
					html += '<span class="linkbtn" onclick="recom(this)" val="1"  gid="'+gid+'">设为店铺推荐</span>';
				}
				$('#sss'+gid).html(html);
			}else{
				wl.sConfirm({'info':data.msg,'cancel':true});
			}
		});
	}
	function show(obj){
		var val = $(obj).attr('val');
		var gid = $(obj).attr('gid');
		var html = '';
		var html1 = '';
		$.get('index.php?app=my_goods&act=ajax_col&column=if_show&value='+val+'&id='+gid,function(data){
			var data = eval('('+data+')');
			if(data.done){
				if(data.retval==1){
					html += '<span class="linkbtn" onclick="show(this)" val="2"  gid="'+gid+'">下架</span>';
					html1 += '出售中';
				}else if(data.retval==2){
					html += '<span class="linkbtn" onclick="show(this)" val="1"  gid="'+gid+'">上架</span>';
					html1 += '已下架';
				}else{
					html += '<span class="linkbtn" onclick="show(this)" val="2"  gid="'+gid+'">下架</span>';
					html1 += '待上架';
				}
				$('#xxx'+gid).html(html);
				$('#hhh'+gid).html(html1);
			}else{
				wl.sConfirm({'info':data.msg,'cancel':true});
			}
		} ,'json');
	}
</script>
{include file=footer.html}
{if $store.enable_radar}
<input type="hidden" id="radar_lincense_id" value="" />
<input type="hidden" id="radar_product_key" value="ecmall" />
<input type="hidden" id="radar_sign_key" value="" />
<script type="text/javascript" src="http://js.sradar.cn/radarForGoodsList.js"></script>
<script>radar_point_extract();</script>
{/if}